package com.tangye.massageshop.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tangye.massageshop.enums.CompanyStatusEnum;
import com.tangye.massageshop.repository.CompanyRepository;
import com.tangye.massageshop.entity.CompanyEntity;
import com.tangye.massageshop.mapper.CompanyMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;

@Service
public class CompanyRepositoryImpl implements CompanyRepository {

    @Resource
    private CompanyMapper companyMapper;
    @Override
    public CompanyEntity selectEnableByName(String name) {
        QueryWrapper<CompanyEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("company_name", name);
        queryWrapper.in("company_status", Arrays.asList(CompanyStatusEnum.NORMAL.getCode(), CompanyStatusEnum.FROZEN.getCode()));
        return companyMapper.selectOne(queryWrapper);
    }
}
